#ifdef _WINDOWS
#include <Windows.h>
#endif

#pragma once

#include "timer.h"

class Thread {
public:
	Thread();
	~Thread();
	bool start(int processorAffinity);
	void stop();
	void sleep(LONG64 milliseconds);
	bool fpsLimit(int fpsLimit, double timePerFrame);
	virtual void run() = 0;
#ifdef _WINDOWS
	HANDLE threadHandle;
#endif
	bool running;
private:
	static unsigned long __stdcall threadProc(void* ptr);
	Thread* threadObj;
#ifdef _WINDOWS
	LARGE_INTEGER lastTotalSystemTime;
	LARGE_INTEGER lastThreadUsageTime;
	DWORD threadID;
#endif
protected:

};